<template>
    <div style="margin-top:10px">
        <div class="block">
            <el-pagination :current-page="currentPage" :page-size="pageSize" layout="total,  prev, pager, next, jumper"
                :total="total" @current-change="handleCurrentChange">
            </el-pagination>
        </div>
    </div>
</template>
<script>
import axios from 'axios';
export default {
    data() {
        return {
            pageSize: 0,
            pagerCount: 0,
            total: 0,
            currentPage: 1,
        }
    },
    methods: {
        handleCurrentChange(val) {

        },

    },
    beforeMount: function () {
        let that = this;
        axios.get('http://127.0.0.1:5000/api/' + entity + '/get_list', {
            params: {
                page: 1,
                size: that.pageSize
            }
        })
            .then(function (response) {
                console.log(response.data.result);
                that.total = Number.parseInt(response.data.result.count);
                that.pagerCount = that.total % that.pageSize;
            })
            .catch(function (error) {
                console.log(error);
            })
            .then(function () {
                // 总是会执行
            })
    }
}
</script>